package cn.cs.controller;

import cn.cs.common.Dto;
import cn.cs.common.DtoUtil;
import cn.cs.common.EmptyUtils;
import cn.cs.service.WithdrawalPayService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;


@RestController
@RequestMapping(value = "/qgTrade")
public class QgTradeController {

    @Resource
    private WithdrawalPayService withdrawalPayService;


    /**
     * 分页查询 资金明细
     * @param pageNumber
     * @param pageSize
     * @return
     * @throws Exception
     * TODO 添加搜索
     */
    @RequestMapping(value = "/csPlatform/getQgTradeByPage")
    public Dto getQgTradeByPage(Integer pageNumber, Integer pageSize, String startDate, String endDate)throws Exception{
        Map<String, Object> param = new HashMap<>();
        if(EmptyUtils.isNotEmpty(startDate)){
            param.put("startDate", startDate + "00:00:00");
        }
        if(EmptyUtils.isNotEmpty(endDate)){
            param.put("endDate", endDate + "23:59:59");
        }
        return DtoUtil.returnSuccess("获取成功", withdrawalPayService.queryQgTradePageByMap(param, pageNumber, pageSize));
    }


}
